package com.objecteffects.template.service;

import com.google.inject.Inject;
import com.google.inject.persist.Transactional;

import com.objecteffects.template.model.BlogPostsOffsetEntity;
import com.objecteffects.template.persist.api.IBlogPostsOffsetEntityDao;
import com.objecteffects.template.util.logger.InjectLogger;

import org.slf4j.Logger;

/**
 * @author Rusty Wright
 */
public class BlogPostsOffsetEntityService {
    @InjectLogger
    private Logger log;

    private final IBlogPostsOffsetEntityDao dao;

    /** */
    @Inject
    BlogPostsOffsetEntityService(final IBlogPostsOffsetEntityDao _dao) {
        this.dao = _dao;
    }

    @Transactional
    public void save(final BlogPostsOffsetEntity input) {
        this.dao.save(input);
    }

    @Transactional
    public BlogPostsOffsetEntity update(final BlogPostsOffsetEntity entity) {
        return this.dao.update(entity);
    }

    @Transactional
    public void deleteById(final Long id) {
        this.dao.deleteById(id);
    }

    @Transactional
    public BlogPostsOffsetEntity findByUserIdAndUrl(final Long userId,
        final String url) {
        return this.dao.findByUserIdAndUrl(userId, url);
    }
}
